<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/hexo/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/hexo/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/hexo/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/hexo/images/logo.svg" color="#222">

<link rel="stylesheet" href="/hexo/css/main.css">


<link rel="stylesheet" href="/hexo/lib/font-awesome/css/all.min.css">

<script id="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"hf98.gitee.io","root":"/hexo/","scheme":"Pisces","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12,"onmobile":false},"copycode":{"enable":false,"show_result":false,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}}};
  </script>

  <meta name="description" content="DHCP1. 基础概念从bootp协议发展来，UDP封装 服务器端口67，客户端端口68 动态分配TCP&#x2F;IP信息（地址、掩码、默认网关、DNS等），同时分配出去的IP具有租约 - 系统组成 dhcp client 客户端：需要动态获得IP地址的主机 dhcp server 服务器：能提供DHCP功能的服务器或网络设备 dhcp relay  中继  ：为路由器或三层交换机等网络设备 -dhcp">
<meta property="og:type" content="article">
<meta property="og:title" content="DHCP">
<meta property="og:url" content="http://hf98.gitee.io/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/dhcp/">
<meta property="og:site_name" content="梁汉烽的博客">
<meta property="og:description" content="DHCP1. 基础概念从bootp协议发展来，UDP封装 服务器端口67，客户端端口68 动态分配TCP&#x2F;IP信息（地址、掩码、默认网关、DNS等），同时分配出去的IP具有租约 - 系统组成 dhcp client 客户端：需要动态获得IP地址的主机 dhcp server 服务器：能提供DHCP功能的服务器或网络设备 dhcp relay  中继  ：为路由器或三层交换机等网络设备 -dhcp">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://hf98.gitee.io/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/dhcp/dhcp_md_files/image_20200716100222.png?v=1&type=image&token=V1:cxjQDtfpjmh4BDmBNxwwaFqED_qsDIQ0vuAReyi-fj0">
<meta property="article:published_time" content="2020-07-04T16:00:00.000Z">
<meta property="article:modified_time" content="2020-08-10T06:38:57.864Z">
<meta property="article:author" content="Liang HF">
<meta property="article:tag" content="网络">
<meta property="article:tag" content="路由协议">
<meta property="article:tag" content="DHCP">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://hf98.gitee.io/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/dhcp/dhcp_md_files/image_20200716100222.png?v=1&type=image&token=V1:cxjQDtfpjmh4BDmBNxwwaFqED_qsDIQ0vuAReyi-fj0">

<link rel="canonical" href="http://hf98.gitee.io/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/dhcp/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>

  <title>DHCP | 梁汉烽的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/hexo/" class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <h1 class="site-title">梁汉烽的博客</h1>
      <span class="logo-line-after"><i></i></span>
    </a>
      <p class="site-subtitle" itemprop="description">日常学习总结</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>




<nav class="site-nav">
  <ul id="menu" class="main-menu menu">
        <li class="menu-item menu-item-home">

    <a href="/hexo/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/hexo/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/hexo/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/hexo/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a>

  </li>
  </ul>
</nav>




</div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content post posts-expand">
            

    
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://hf98.gitee.io/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/dhcp/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/hexo/images/avatar.gif">
      <meta itemprop="name" content="Liang HF">
      <meta itemprop="description" content="普通人">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="梁汉烽的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          DHCP
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-calendar"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              <time title="创建时间：2020-07-05 00:00:00" itemprop="dateCreated datePublished" datetime="2020-07-05T00:00:00+08:00">2020-07-05</time>
            </span>
              <span class="post-meta-item">
                <span class="post-meta-item-icon">
                  <i class="far fa-calendar-check"></i>
                </span>
                <span class="post-meta-item-text">更新于</span>
                <time title="修改时间：2020-08-10 14:38:57" itemprop="dateModified" datetime="2020-08-10T14:38:57+08:00">2020-08-10</time>
              </span>
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="far fa-folder"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/hexo/categories/%E8%B7%AF%E7%94%B1%E4%BA%A4%E6%8D%A2/" itemprop="url" rel="index"><span itemprop="name">路由交换</span></a>
                </span>
            </span>

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h2 id="DHCP"><a href="#DHCP" class="headerlink" title="DHCP"></a>DHCP</h2><h3 id="1-基础概念"><a href="#1-基础概念" class="headerlink" title="1. 基础概念"></a>1. 基础概念</h3><pre><code>从bootp协议发展来，UDP封装 服务器端口67，客户端端口68
动态分配TCP/IP信息（地址、掩码、默认网关、DNS等），同时分配出去的IP具有租约
- 系统组成
dhcp client 客户端：需要动态获得IP地址的主机
dhcp server 服务器：能提供DHCP功能的服务器或网络设备
dhcp relay  中继  ：为路由器或三层交换机等网络设备
-dhcp 报文类型
discover dhcp找寻dhcp服务器                            （广播）
offer     dhcp用来相应discover报文，携带了各种配置信息    （二层单播）
request  dhcp用来确认配置                                （广播）
ack         dhcp对request报文的确认                        （二层单播）
nak         dhcp对request报文的拒绝
release  dhcp客户端要释放地址来通知服务器
- dhcp 地址池
接口地址池的优先级比全局地址池高
全局地址池用于将网关与dhcp分离，通过独立的dhcp服务器配置大域内的终端地址。</code></pre>
<h3 id="2-DHCP工作流程"><a href="#2-DHCP工作流程" class="headerlink" title="2. DHCP工作流程"></a>2. DHCP工作流程</h3><ol>
<li><p>申请IP<br><img src="dhcp_md_files/image_20200716100222.png?v=1&type=image&token=V1:cxjQDtfpjmh4BDmBNxwwaFqED_qsDIQ0vuAReyi-fj0"></p>
</li>
<li><p>租期更新</p>
<pre><code> 1.租户于50%租期会发送DHCP单播request报文给dhcp服务器，确认更新则会通过dhcp ack返回    
 2.若到达12.5%租期时，client会发送discover广播包，请求dhcp中新的IP地址。</code></pre>
</li>
<li><p>自动保留IP<br>当租期结束之后，服务器会自动分配169段IP临时通信</p>
</li>
<li><p>租期<br>流动场所设置较短租期（保证地址池的可用性），固定场所设置较长</p>
<h3 id="3-DHCP-命令"><a href="#3-DHCP-命令" class="headerlink" title="3. DHCP 命令"></a>3. DHCP 命令</h3><p> 1.接口模式<br> dhcp select {interface|global}        关联接口和接口地址池<br> dhcp server dns-list                 指定接口地址池的DNS服务器<br> dhcp server lease [time]            配置接口地址池的租期，默认为1天<br> dhcp server    exclude-ip-address         排除的地址池租期范围<br> dhcp server static-bind ip-address [ip address] mac-address [mac address]                            配置静态绑定<br> 2.系统模式<br> dhcp enable                         开启dhcp功能<br> ip pool    [pool]                        创建地址池(需配置网络 网关 租期时间)</p>
</li>
</ol>

    </div>

    
    
    

      <footer class="post-footer">
          <div class="post-tags">
              <a href="/hexo/tags/%E7%BD%91%E7%BB%9C/" rel="tag"># 网络</a>
              <a href="/hexo/tags/%E8%B7%AF%E7%94%B1%E5%8D%8F%E8%AE%AE/" rel="tag"># 路由协议</a>
              <a href="/hexo/tags/DHCP/" rel="tag"># DHCP</a>
          </div>

        


        
    <div class="post-nav">
      <div class="post-nav-item">
    <a href="/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/%E6%8E%92%E9%94%99%E6%B5%81%E7%A8%8B/" rel="prev" title="ACL">
      <i class="fa fa-chevron-left"></i> ACL
    </a></div>
      <div class="post-nav-item">
    <a href="/hexo/2020/07/05/na/%E8%B7%AF%E7%94%B1/VRP/" rel="next" title="VRP">
      VRP <i class="fa fa-chevron-right"></i>
    </a></div>
    </div>
      </footer>
    
  </article>
  
  
  



          </div>
          

<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      let commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
          <div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#DHCP"><span class="nav-number">1.</span> <span class="nav-text">DHCP</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#1-%E5%9F%BA%E7%A1%80%E6%A6%82%E5%BF%B5"><span class="nav-number">1.1.</span> <span class="nav-text">1. 基础概念</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-DHCP%E5%B7%A5%E4%BD%9C%E6%B5%81%E7%A8%8B"><span class="nav-number">1.2.</span> <span class="nav-text">2. DHCP工作流程</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#3-DHCP-%E5%91%BD%E4%BB%A4"><span class="nav-number">1.3.</span> <span class="nav-text">3. DHCP 命令</span></a></li></ol></li></ol></div>
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">Liang HF</p>
  <div class="site-description" itemprop="description">普通人</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/hexo/archives/">
        
          <span class="site-state-item-count">15</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/hexo/categories/">
          
        <span class="site-state-item-count">2</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/hexo/tags/">
          
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        

        

<div class="copyright">
  
  &copy; 
  <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Liang HF</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动
  </div>

        








      </div>
    </footer>
  </div>

  
  <script src="/hexo/lib/anime.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.min.js"></script>
  <script src="/hexo/lib/velocity/velocity.ui.min.js"></script>

<script src="/hexo/js/utils.js"></script>

<script src="/hexo/js/motion.js"></script>


<script src="/hexo/js/schemes/pisces.js"></script>


<script src="/hexo/js/next-boot.js"></script>




  















  

  

</body>
</html>
